package com.qf.zyh.services.admin.Impl;

import com.qf.zyh.dao.admin.Impl.TypeadDaoImpl;
import com.qf.zyh.dao.admin.TypeadDao;
import com.qf.zyh.entity.Type;
import com.qf.zyh.entity.User;
import com.qf.zyh.services.admin.TypeServices;
import com.qf.zyh.util.DBUtil;

import java.util.List;

public class TypeServicesImpl implements TypeServices {
    TypeadDao tad = new TypeadDaoImpl();

    @Override
    public List<Type> seleall() {
        try {
            DBUtil.begin();
            List<Type> list = tad.seleall();
            DBUtil.commit();
            return list;
        } catch (Exception e) {
            e.printStackTrace();
            DBUtil.rollback();
        }
        return null;
    }

    @Override
    public List<Type> selein(String tname, String tinfo) {
        try {
            DBUtil.begin();
            List<Type> typeList = tad.selein(tname,tinfo);
            DBUtil.commit();
            return typeList;
        } catch (Exception e) {
            e.printStackTrace();
            DBUtil.rollback();
        }
        return null;
    }

    @Override
    public void del(Integer tid) {
        try {
            DBUtil.begin();
            tad.del(tid);
            DBUtil.commit();
        } catch (Exception e) {
            e.printStackTrace();
            DBUtil.rollback();
        }
    }
}
